﻿using System;
using UnityEngine;

namespace UniRx.Diagnostics
{
	// Token: 0x020003B7 RID: 951
	public class UnityDebugSink : IObserver<LogEntry>
	{
		// Token: 0x0600137F RID: 4991 RVA: 0x00058CC2 File Offset: 0x000570C2
		public void OnCompleted()
		{
		}

		// Token: 0x06001380 RID: 4992 RVA: 0x00058CC4 File Offset: 0x000570C4
		public void OnError(Exception error)
		{
		}

		// Token: 0x06001381 RID: 4993 RVA: 0x00058CC8 File Offset: 0x000570C8
		public void OnNext(LogEntry value)
		{
			object context = value.Context;
			switch (value.LogType)
			{
			case LogType.Error:
				if (context == null)
				{
					Debug.LogError(value.Message);
				}
				else
				{
					Debug.LogError(value.Message, value.Context);
				}
				break;
			case LogType.Warning:
				if (context == null)
				{
					Debug.LogWarning(value.Message);
				}
				else
				{
					Debug.LogWarning(value.Message, value.Context);
				}
				break;
			case LogType.Log:
				if (context == null)
				{
					Debug.Log(value.Message);
				}
				else
				{
					Debug.Log(value.Message, value.Context);
				}
				break;
			case LogType.Exception:
				if (context == null)
				{
					Debug.LogException(value.Exception);
				}
				else
				{
					Debug.LogException(value.Exception, value.Context);
				}
				break;
			}
		}
	}
}
